<!-- navbar -->
<nav class="navbar navbar-default navbar-fixed-top custom-no-margin">
  <div class="container">
    <div class="navbar-header">
      <a href="{{ '/' }}" class="navbar-brand">
        <img id="mflogo" src="{{ '/assets/images/logo/marlin/text.png' }}" alt="Marlin" height="40" />
      </a>
      <img id="daynite" src="{{ '/assets/images/btn-night.svg' }}" alt="Dark Mode" width="32" height="32" />
      <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>

    <div class="navbar-collapse collapse" id="navbar-main">
      <ul class="nav navbar-nav">

        <li><a href="{{ '/docs/basics/introduction.html' }}">About Marlin</a></li>
        <li><a href="{{ '/meta/download/' }}">Download</a></li>
        <li><a href="{{ '/docs/configuration/configuration.html' }}">Configure</a></li>
        <li><a href="{{ '/docs/basics/install.html' }}">Install</a></li>

        <li class="dropdown">
          <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="navbar-tools">Tools <span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="{{ '/tools/u8glib/converter.html' }}">Bitmap Converter</a></li>
            <li><a href="{{ '/tools/lin_advance/k-factor.html' }}">K-Factor Calibration Pattern</a></li>
            <li class="divider"></li>
            <li><a href="//github.com/MarlinFirmware/Marlin/issues">Bugtracker</a></li>
            <li><a href="{{ '/docs/basics/reporting_bugs.html' }}">Reporting bugs</a></li>
            <li class="divider"></li>
            <li><a href="//github.com/MarlinFirmware/Marlin">Source Code Repository</a></li>
          </ul>
        </li>

        {% assign list = ('' | split: '|') %}
        {% for col in site.collections %}
          {% if col.title %}{% assign list = list | push: col %}{% endif %}
        {% endfor %}
        {% if list.size > 0 %}{% assign list = (list | sort: 'title') %}{% endif %}

        <li class="dropdown">
          <a class="dropdown-toggle" data-toggle="dropdown" href="#" id="navbar-documentation">Help <span class="caret"></span></a>
          <ul class="dropdown-menu">
            {% if list.size > 0 %}
              {% for col in list %}
                {% if col.title %}
                  <li class="dropdown-submenu {{ col.label }}">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ col.title }}</a>
                    <ul class="dropdown-menu">
                      <li><a href="{{ '/meta/' | append: col.label | append: '/' }}">
                        All documents
                      </a></li>
                      {% if col.label == 'gcode' %}
                        <li class="divider"></li>
                        {% assign docs = (col.docs | sort: 'tag') %}
                        {% for doc in docs %}
                          {% if doc.title %}
                            <li><a href="{{ doc.url }}"><strong>{{ doc.codes | codes_desc }}</strong>: {{ doc.title }}</a></li>
                          {% endif %}
                        {% endfor %}
                      {% else %}
                        {% assign docs = (col.docs | group_by: 'tag' | sort: 'title') %}
                        {% for tag in docs %}
                          <li class="divider"></li>
                          {% for doc in tag.items %}
                            {% if doc.title %}<li><a href="{{ doc.url }}">{{ doc.title }}</a></li>{% endif %}
                          {% endfor %}
                        {% endfor %}
                      {% endif %}
                    </ul>
                  </li>
                {% endif %}
              {% endfor %}
            {% endif %}
            <li><a href="{{ '/docs/basics/troubleshooting.html' }}">Troubleshooting</a></li>
            <li class="divider"></li>
            <li><a href="{{ '/meta/needs-review/' }}">Documentation Needing Review</a></li>
          </ul>
        </li>
        <li id="searchbox">
          <form action="/meta/search/">
            <input type="search" name="q" placeholder="Search" />
          </form>
        </li>
      </ul>

      <ul class="nav navbar-nav navbar-right visible-lg-block">
        <li>
          {% if page.collection %}
            <a href="{{ site.repository.doc }}/edit/master/{{ page.path }}" data-proofer-ignore>
            <i class="fa fa-pencil-square-o" aria-hidden="true"></i>
            <span>Edit Page</span>
            </a>
          {% else %}
            <a href="//twitter.com/MarlinFirmware" class="twitter-follow-button" data-show-count="false">Follow @MarlinFirmware</a><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
          {% endif %}
        </li>
      </ul>

    </div>
  </div>
</nav>
<!-- /navbar -->
